/**
 * @author sce
 * @description 提供参数映射服务
 */

export default (resource: object | any, target: any) => {
    Object.keys(resource).forEach((item) => {
        target[item] = resource[item];
    });
};

export function paramMapByArr(resource: object | any, arr: [string] | any) {
    const result: any = {};
    for (let i = 0, len = arr.length; i < len; i++) {
        resource[arr[i]] && (result[arr[i]] = resource[arr[i]]);
    }
    return result;
}